package com.yanqu.road.server.manger.assistant;

import com.yanqu.road.pb.assistant.AssistantProto;
import com.yanqu.road.server.gameplayer.GamePlayer;

/**
 * 跨服操作
 */
public abstract class CrossActionHandler {

    /**
     * 是否发送到跨服处理,true不继续后续操作
     */
    protected boolean success;

    protected abstract void action(GamePlayer player, AssistantProto.AssistantActionReqMsg.Builder reqMsg, AssistantProto.AssistantActionRespMsg.Builder respMsg);

    protected abstract void nextHandler(GamePlayer player, AssistantProto.AssistantActionReqMsg.Builder reqMsg, AssistantProto.AssistantActionRespMsg.Builder respMsg);

    public void handle(GamePlayer player, AssistantProto.AssistantActionReqMsg.Builder reqMsg, AssistantProto.AssistantActionRespMsg.Builder respMsg) {
        this.action(player, reqMsg, respMsg);
        // 进行后续操作
        if (!success) {
            this.nextHandler(player, reqMsg, respMsg);
        }

    }

}
